import React from "react";

export default class HelloWorld extends React.Component {
    constructor() {
        super();
        console.log("HelloWorld constructor");
        this.state = {
            message: "Hello World"
        }
    }

    changeMessage() {
        this.setState({message: "Hello React"})
    }

    render() {
        const {message} = this.state
        console.log("HelloWorld render");
        return <div>
            <h2>{message}</h2>
            <button onClick={() => this.changeMessage()}>change</button>
        </div>

    }

    componentDidMount() {
        console.log("HelloWorld componentDidMount");
    }
    componentDidUpdate(prevProps, prevState, snapshot) {
        console.log("HelloWorld componentDidUpdate");
    }
}